﻿using eLibrary;

namespace Letter.IO.Channels;

partial class Channel<T>
{
    sealed class ChannelReader : IChannelReader<T>
    {
        public ChannelReader(Channel<T> channel)
        {
            this.Channel = channel;
        }

        private Channel<T> Channel
        {
            get;
        }

        public bool Active
        {
            get { return this.Channel.Writable; }
        }

        public long Count
        {
            get { return this.Channel.Pressure; }
        }

        public void SetListener(ActionAsync<T> func)
        {
            this.Channel.NotifyFunc = func;
        }
    }
}
